| Fully Qualified Name: | CodeIgniter\Session\SessionInterface |
Expected behavior of a session container used with CodeIgniter.
| Name | Description | Defined By |
|---|---|---|
| destroy() | Destroys the current session. | SessionInterface |
| get() | Get user data that has been set in the session. | SessionInterface |
| getFlashKeys() | Retrieve all of the keys for session data marked as flashdata. | SessionInterface |
| getFlashdata() | Retrieve one or more items of flash data from the session. | SessionInterface |
| getTempKeys() | Retrieve the keys of all session data that have been marked as temporary data. | SessionInterface |
| getTempdata() | Returns either a single piece of tempdata, or all temp data currently in the session. | SessionInterface |
| has() | Returns whether an index exists in the session array. | SessionInterface |
| keepFlashdata() | Keeps a single piece of flash data alive for one more request. | SessionInterface |
| markAsFlashdata() | Mark a session property or properties as flashdata. | SessionInterface |
| markAsTempdata() | Mark one of more pieces of data as being temporary, meaning that it has a set lifespan within the session. | SessionInterface |
| regenerate() | Regenerates the session ID. | SessionInterface |
| remove() | Remove one or more session properties. | SessionInterface |
| removeTempdata() | Removes a single piece of temporary data from the session. | SessionInterface |
| set() | Sets user data into the session. | SessionInterface |
| setFlashdata() | Sets data into the session that will only last for a single request. | SessionInterface |
| setTempdata() | Sets new data into the session, and marks it as temporary data with a set lifespan. | SessionInterface |
| unmarkFlashdata() | Unmark data in the session as flashdata. | SessionInterface |
| unmarkTempdata() | Unmarks temporary data in the session, effectively removing its lifespan and allowing it to live as long as the session does. | SessionInterface |
Destroys the current session.
Returns:
Get user data that has been set in the session.
If the property exists as "normal", returns it. Otherwise, returns an array of any temp or flash data values with the property key.
Replaces the legacy method $session->userdata();
| Parameter Name | Type | Description |
|---|---|---|
| $key | string | Identifier |
Returns: array|null The property value(s)
Retrieve all of the keys for session data marked as flashdata.
Returns: array The property names of all flashdata
Retrieve one or more items of flash data from the session.
If the item key is null, return all flashdata.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string | Property |
Returns: array|null The requested property value, or an associative array of them
Retrieve the keys of all session data that have been marked as temporary data.
Returns: array
Returns either a single piece of tempdata, or all temp data currently in the session.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string | Session |
Returns: mixed Session data value or null if not found.
Returns whether an index exists in the session array.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string | Identifier |
Returns: bool
Keeps a single piece of flash data alive for one more request.
| Parameter Name | Type | Description |
|---|---|---|
| $key | array|string | Property |
Returns:
Mark a session property or properties as flashdata.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string|array | Property |
Returns: bool if any of the properties are not already set
Mark one of more pieces of data as being temporary, meaning that it has a set lifespan within the session.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string|array | Property |
| $ttl | int | Time |
Returns: bool False if any of the properties were not set
Regenerates the session ID.
| Parameter Name | Type | Description |
|---|---|---|
| $destroy | bool | Should |
Returns:
Remove one or more session properties.
If $key is an array, it is interpreted as an array of string property identifiers to remove. Otherwise, it is interpreted as the identifier of a specific session property to remove.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string|array | Identifier |
Returns:
Removes a single piece of temporary data from the session.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string | Session |
Returns:
Sets user data into the session.
If $data is a string, then it is interpreted as a session property key, and $value is expected to be non-null.
If $data is an array, it is expected to be an array of key/value pairs to be set as session properties.
| Parameter Name | Type | Description |
|---|---|---|
| $data | string|array | Property |
| $value | string|array | Property |
Returns:
Sets data into the session that will only last for a single request.
Perfect for use with single-use status update messages.
If $data is an array, it is interpreted as an associative array of key/value pairs for flashdata properties. Otherwise, it is interpreted as the identifier of a specific flashdata property, with $value containing the property value.
| Parameter Name | Type | Description |
|---|---|---|
| $data | string|array | Property |
| $value | string|array | Property |
Returns:
Sets new data into the session, and marks it as temporary data with a set lifespan.
| Parameter Name | Type | Description |
|---|---|---|
| $data | string|array | Session |
| $value | mixed | Value |
| $ttl | int | Time-to-live |
Returns:
Unmark data in the session as flashdata.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string|array | Property |
Returns:
Unmarks temporary data in the session, effectively removing its lifespan and allowing it to live as long as the session does.
| Parameter Name | Type | Description |
|---|---|---|
| $key | string|array | Property |
Returns: